<?php

class Application_Model_Event {

    private $id;
    private $date;
    private $content;
    private $picturepath;
    private $owner;
    private $title;
    private $comments;
    private $pertinence;

    function __construct() {
        $this->owner = new Application_Model_People("", "");
        $this->comments = Array();
        $this->pertinence = 1;
    }

    public function getTitle() {
        return $this->title;
    }

    public function setTitle($title) {
        $this->title = $title;
    }

    public function getId() {
        return $this->id;
    }

    public function setId($id) {
        $this->id = $id;
    }

    public function getDate() {
        return $this->date;
    }

    public function setDate($date) {
        $this->date = $date;
    }

    public function getStakeholders() {
        return $this->stakeholders;
    }

    public function addStakeholders($stakeholder) {
        $this->stakeholders[] = $stakeholder;
    }

    public function getContent() {
        return $this->content;
    }

    public function setContent($content) {
        $this->content = $content;
    }

    public function getPicturepath() {
        return $this->picturepath;
    }

    public function setPicturepath($picturepath) {
        $this->picturepath = $picturepath;
    }

    public function getOwner() {
        return $this->owner;
    }

    public function setOwner($owner) {
        $this->owner = $owner;
    }

    public function getComments() {
        return $this->comments;
    }

    public function setComments($comments) {
        $this->comments = $comments;
    }

    public function getPertinence() {
        return $this->pertinence;
    }

    public function setPertinence($pertinence) {
        $this->pertinence = $pertinence;
    }

    public function increasePertinence() {
        $this->pertinence++;
    }

    public function toArray() {
        $tab = Array("id" => $this->getId(),
            "owner_firstname" => $this->getOwner()->getFirstName(),
            "owner_name" => $this->getOwner()->getName(),
            "date" => $this->getDate(),
            "content" => $this->getContent(),
            "image" => $this->getPicturepath(),
            "title" => $this->getTitle());

        return $tab;
    }

    static function cmp($event1, $event2) {
        $a = $event1->getPertinence();
        $b = $event2->getPertinence();
        if ($a == $b) {
            return 0;
        }
        return ($a < $b) ? -1 : 1;
    }

}

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
